package com.qfedu.controller;

import com.qfedu.pojo.req.QAUReq;
import com.qfedu.pojo.resp.BaseResp;
import com.qfedu.service.QuestionService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/qa")
@Api(tags="问答")
public class QAController {
    @Autowired
    QuestionService questionService;
    //找出所有问题以及相关答案
    @PostMapping("/findAllQuestion")
    public BaseResp findAllQuestion(){
        return questionService.findAll();
    }
    //找出具体某个问题的相关答案
    @PostMapping("/findQAByQuestionId")
    public BaseResp findQAByQuestionId(@RequestBody QAUReq qauReq){
        return questionService.findQAByQuestionId(qauReq.getQuestionId());
    }
}
